package com.dys.rowmapper.impl;

import com.dys.entity.Person;
import com.dys.rowmapper.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Author: 疾风
 * @ClassName: PersonRowMapper
 * @Description: 具体的Dao中使用DaoUtils的公共查询方法，需要将RowMapper做对应的实现
 * @CreateDate: 2024/09/14
 * @Version: v1.0.0
 */
public class PersonRowMapper implements RowMapper<Person> {
    @Override
    public Person rowMapper(ResultSet rs) throws SQLException {
        Person person = new Person();
        person.setId(rs.getInt("id"));
        person.setName(rs.getString("name"));
        person.setAge(rs.getInt("age"));
        person.setDateOfBirth(rs.getDate("date_of_birth"));
        person.setEmail(rs.getString("email"));
        person.setAddress(rs.getString("address"));
        return person;
    }
}
